#!/bin/bash

# Display current version or update version if used with version as argument

cd `git rev-parse --show-toplevel`

VERSION=`grep VERSION= Makefile | sed -e 's/VERSION=\(.*\)/\1/'`
if [ -z "$1" ]; then
    echo $VERSION
elif [ "$1" != "$VERSION" ]; then
    sed -e "s/{{VERSION}}/"$1"/" templates/Makefile.in > Makefile
    git mv css/jquery.terminal-${VERSION}.css css/jquery.terminal-${1}.css
    git mv css/jquery.terminal-${VERSION}.min.css css/jquery.terminal-${1}.min.css
    git mv js/jquery.terminal-${VERSION}.js js/jquery.terminal-${1}.js
    git mv js/jquery.terminal-${VERSION}.min.js js/jquery.terminal-${1}.min.js
    rm .${VERSION}
fi
